export default {
	data() {
		return {
			idfa:'',
			
		}
	},
	computed: {
		systemType(){
			switch(uni.getSystemInfoSync().platform){
			    case 'android':
			       return "0"
			       break;
			    case 'ios':
			       return "1"
			       break;
			    default:
			       return "0"
			       break;
			}
		}
	},
	onLaunch() {		
		// if (plus.os.name == "iOS" || plus.os.name == "ios") {
		// 	var ASIdentifierManager = plus.ios.importClass("ASIdentifierManager");
		// 	if(ASIdentifierManager){
		// 		var sharedManager = ASIdentifierManager.sharedManager();
		// 		if (sharedManager.isAdvertisingTrackingEnabled()) {
		// 			var advertisingIdentifier = sharedManager.advertisingIdentifier();
		// 			var idfa = plus.ios.invoke(advertisingIdentifier, "UUIDString");
		// 			this.idfa = idfa;
		// 		}
		// 	}
		// }
	},
	methods: {
		//注册成功后调取今日头条监控
		sendToutiao(){
			let dataObj = {
				'callback':window.encodeURI('lAZogVA-rpHXj-hFI-FdKVBUpZKgYWntX'),
				'os': this.systemType,
				'event_type': 1,  //注册成功
				'conv_time': parseInt(new Date().getTime()/1000),
				"source": "mybestcustom"
			};
			if( this.systemType==1 ){ //ios
				dataObj.idfa = ''
			}else{ //安卓和其他
				dataObj.imei = '85B7652B11806D1A7BA1E1121B08951A'
			};
			uni.request({
				url: 'http://www.txzh.com.cn/api.php?app=Default&act=Sendtoutiao',  
				method: 'get',
				header: {
					'Content-Type': 'application/x-www-form-urlencoded',
					'X-Requested-With': 'xmlhttprequest'
				},
				data:dataObj,
				success: res => {
					
				},  
				fail: () => {}
			});
		}
	}
}